import { HttpUrlVariable } from '@/constants'
import type { PatientForm, PatientItem } from '@/types/archive'
import RequestHttp from '@/utils/request'

export const getArchiveListAPI = () =>
  RequestHttp.get<PatientItem[]>(HttpUrlVariable.ARCHIVE_LISR_URL)

export const delArchiveAPI = (id: string) =>
  RequestHttp.delete<null>(`${HttpUrlVariable.ARCHIVE_DEL_URL}${id}`)

export const addArchiveAPI = (data: PatientForm) =>
  RequestHttp.post<null, PatientForm>(HttpUrlVariable.ARCHIVE_ADD_URL, data)

export const getArchiveDetailAPI = (id: string) =>
  RequestHttp.get<PatientForm>(`${HttpUrlVariable.ARCHIVE_DETAIL_URL}${id}`)

// 更新接口
export const updateArchiveAPI = (data: PatientForm) =>
  RequestHttp.put<null, PatientForm>(HttpUrlVariable.ARCHIVE_UPDATE_URL, data)
